package china.accountinghelper.model;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

public class ModelExpense implements Serializable
{
    private static final long serialVersionUID = 1L;

    // 消费记录ID
    private long              mID;
    // 所属账本ID，外键
    private long              mBookID;
    // 消费类型ID，外键
    private long              mCategoryID;
    // 付款人ID，外键
    private long              mPayerID;
//    消费日期
    private Calendar mExpenseDate;
    // 建立时间
    private Calendar          mCreateTime;
    // 备注
    private String            mComment;
    
    public ModelExpense()
    {
        mID = 0;
        mBookID = 0;
        mCategoryID = 0;
        mPayerID = 0;
        mCreateTime = null;
        mComment = null;
    }
    
    
    public long getID()
    {
        return mID;
    }

    public void setID(long pID)
    {
        this.mID = pID;
    }

    public long getBookID()
    {
        return mBookID;
    }

    public void setBookID(long pBookID)
    {
        this.mBookID = pBookID;
    }

    public long getCategoryID()
    {
        return mCategoryID;
    }

    public void setCategoryID(long pCategoryID)
    {
        this.mCategoryID = pCategoryID;
    }

    public long getPayerID()
    {
        return mPayerID;
    }

    public void setPayerID(long pPayerID)
    {
        this.mPayerID = pPayerID;
    }

    public Calendar getExpenseDate()
    {
        return mExpenseDate;
    }

    public void setExpenseDate(Calendar pExpenseDate)
    {
        mExpenseDate = Calendar.getInstance();
        mExpenseDate.setTimeInMillis(pExpenseDate.getTimeInMillis());
    }

    public void setExpenseDate(Date pExpenseDate)
    {
        mExpenseDate = Calendar.getInstance();
        mExpenseDate.setTimeInMillis(pExpenseDate.getTime());
    }
    
    public void setExpenseDate(long pExpenseDate)
    {
        mExpenseDate = Calendar.getInstance();
        mExpenseDate.setTimeInMillis(pExpenseDate);
    }
    
    public Calendar getCreateTime()
    {
        return mCreateTime;
    }

    public void setCreateTime(Calendar pCreateTime)
    {
        mCreateTime = Calendar.getInstance();
        mCreateTime.setTimeInMillis(pCreateTime.getTimeInMillis());
    }
    public void setCreateTime(Date pCreateTime)
    {
        mCreateTime = Calendar.getInstance();
        mCreateTime.setTimeInMillis(pCreateTime.getTime());
    }
    public void setCreateTime(long pCreateTime)
    {
        mCreateTime = Calendar.getInstance();
        mCreateTime.setTimeInMillis(pCreateTime);
    }

    public String getComment()
    {
        return mComment;
    }

    public void setComment(String pComment)
    {
        this.mComment = pComment;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + (int) (mID ^ (mID >>> 32));
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        ModelExpense other = (ModelExpense) obj;
        if (mID != other.mID) return false;
        return true;
    }

}
